import java.sql.Date;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import play.*;
import play.jobs.*;
import play.test.*;

import models.*;


@Every("60s")
public class GenerationMeteo extends Job
{
	public void doJob()
	{
		List<Course> courses = Course.find("order by date_debut_course desc").fetch();
		
		if(courses.size() > 0)
		{
			Iterator<Course> itor = courses.iterator();
			
			while(itor.hasNext())
			{
				Course c = itor.next();
				if(c.enCours())
				{
					Condition_meteo met = c.modele.carte.genererMeteo();
					System.out.println(c.titre_course + " : meteo generee : " + met.direction_vent + " / " + met.force_vent);
				}
			}
		}		
	}
}
